// $Id: ast.h 21 2015-02-06 01:02:05Z robim.poa@gmail.com $
//-----------------------------------------------------------------------------
// Purpose: Abstract syntax tree related functions
// $Rev: 21 $
// $Author: robim.poa@gmail.com $
// $Date: 2015-02-06 01:02:05 +0000 (Fri, 06 Feb 2015) $

#ifndef AST_H
#define AST_H

#define AST_NONE    0   // Em caso de function não definida.
#define AST_OR      1
#define AST_AND     2
#define AST_NOT     3
#define AST_EQUAL   4
#define AST_NEQUAL  5
#define AST_GREATER 6
#define AST_LESS    7
#define AST_GEQUAL  8
#define AST_LEQUAL  9
#define AST_ASSIGN  10
#define AST_PLUS    11
#define AST_MINUS   12
#define AST_MULTI   13
#define AST_DIVIS   14
#define AST_MODULO  15
#define AST_POWER   16
#define AST_FUNC    100
#define AST_WHILE   101
#define AST_COMPARE 102
#define AST_FOR     103
#define AST_IF      104
#define AST_ELSE    105
#define AST_VALUE   106
#define AST_VAR     107
#define AST_BODY    108


struct node_ast
{
	struct node_ast *left, *right;
	int func;
	float value;
};

struct node_ast* astCreateNode(int func, int data);

void astPrint(struct node_ast *node_ast);

void astPrintTabs(int x);

int astOperatorToFunc(int);

const char* astFuncToString(int ast_func);

void astPrintRecurse(struct node_ast *node_ast, int depth);

#endif